<?php get_header(' '); ?>
<div id="main" class="main-with-sidebar clearfix">
    <div id="post-content">
		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
        <h1><?php the_title(); ?></h1>       
            <div class="post-entry-meta">
            <span class="meta-date"><?php the_time('F jS, Y') ?></span><span class="meta-category"><?php the_category(' '); ?></span><span class="meta-comments"><?php comments_popup_link('0 Comments', '1 Comment', '% Comments'); ?></span>
        </div>
        <!-- END post-entry-meta -->
        <?php the_content(); ?>
        
        <?php
        //get button color for use in the post tags
		if($options['button_color'] != '') { $options['button_color']; } else { echo 'default'; }
		$button_color = $options['button_color']; ?>
        
        <?php the_tags('<div id="post-tags" class="clearfix">',' ', '</div>'); ?>
        <?php
        // check if the related posts are disabled
        if ($options['disable_author_bio'] != true) { ?>
        <div id="post-author" class="clearfix">
            <div id="author-avatar">
            <?php echo get_avatar( get_the_author_email(), '60' ); ?>
            </div><!-- /author-avatar -->
            <div id="author-details">
            <h5>Post Written by</strong> <?php the_author_posts_link(); ?></h5>
            <?php the_author_description(); ?>
            </div><!-- /author-details -->
        </div><!-- /post-author -->
        <?php } ?>
        <?php
        // check if the related posts are disabled
        if ($options['disable_related_posts'] != true) { ?>
        <div id="related-posts" class="clearfix">
            <h4><?php _e( 'Related Posts' ); ?></h4>
            <?php
            $category = get_the_category(); //get first current category ID
            $this_post = $post->ID; // get ID of current post
            $posts = get_posts('numberposts=3&orderby=rand&category=' . $category[0]->cat_ID . '&exclude=' . $this_post);
            ?>
            <?php
            foreach($posts as $post) {
            ?>
            <div class="related-post clearfix">
            <?php
            // check if post has a thumbnail
            if ( has_post_thumbnail() ) { ?>
            <div class="related-post-image">
            	<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" class="opacity"><?php the_post_thumbnail('related-posts'); ?></a>
            </div>
            <!-- END related-post-image -->
            <div class="related-post-content">
                <h5><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title('')?></a></h5>
                <?php the_news_excerpt('25','','','plain','no'); ?>
            </div>
            <!-- END related-post-content -->
            <?php }else { //show this if post doesn't have thumbnail ?>
            <h5><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title('')?></a></h5>
            <?php the_news_excerpt('25','','','plain','no'); ?>
            <?php } ?>
        </div>
        <!-- END related-post -->
        <?php } wp_reset_postdata(); ?>
        </div>
        <!-- END related-posts -->
        <?php } ?>
        <?php comments_template(); ?>  
        <?php endwhile; ?>
        <?php endif; ?>	        
    </div>
	<!-- END post-content -->
<?php get_sidebar(' '); ?>     
<?php get_footer(' '); ?>